package IO;

import java.io.ByteArrayInputStream;
import java.io.IOException;

public class ByteArrayInputStreamTest {
    public static void main(String[] args) throws IOException {
        byte[] buff = new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9};
        ByteArrayInputStream in = new ByteArrayInputStream(buff, 1, 4);
        int data = in.read();
        while (data != -1) {
            System.out.print(data + ",");
            data = in.read();
        }
        in.close();
    }
}
